1. Technical Field:
This invention relates generally to a video display system for presenting representations of three-dimensional objects and, more particularly, to an improved method and apparatus for clearing a Z-buffer in a computer controlled video display system.
2. Discussion:
Computer controlled graphics or video display systems are commonly employed to display images of three-dimensional objects for viewing by an observer. As is commonly known, a video display system has a plurality of pixels arranged in a two-dimensional array of pixel locations on the graphics display, each pixel having an X and Y coordinate. A frame buffer and a separate Z-buffer are provided, each of which includes a plurality of memory locations that are mapped to the plurality of pixel locations. The frame buffer is typically a random access memory (RAM) often implemented with video random access memory (VRAM) and stores information about each pixel location which includes a digital representation of color and intensity for each pixel in an image. This pixel information in each frame is written to the frame buffer in order to produce the individual images or frames which are displayed one after another.
The Z-buffer uses a random access memory (RAM) which is typically implemented using dynamic random access memory (DRAM). The Z-buffer contains information which indicates whether one object on the video display is in front of or behind another object. This enables a video display system to determine whether a given object will be hidden or seen on the display. The Z-buffer generally contains one number for each pixel in the frame buffer. This number is often referred to as the "Z" value and provides an indication of the depth of an object along a Z axis pointing into the plane of the screen. The use of Z values thereby provides a third dimension coordinate and allows for the realization of a three-dimensional view. In the typical video display system, a small Z value indicates that the object is closer to the observer, while a large Z value generally indicates that the object is further away from the observer. Given a plurality of objects corresponding to a given pixel location, objects with a larger Z value will be hidden by objects which have a smaller Z value and are therefore closer to the observer.
In order to present a new image on the display, the frame buffer and Z-buffer must be updated. The conventional approach to updating the frame buffer and Z-buffer generally includes performing a horizontal line-byline raster scan across the video display apparatus. In doing so, a given horizontal scan line has a Y coordinate value and a changing X coordinate value as the image is drawn from one side of the screen to the other. Each pixel location displayed will have an old Z value and an old pixel value stored in the Z-buffer and frame buffer, respectively. For each pixel location, the old Z value in the Z-buffer is read for the current pixel location. For that current pixel location, a new Z value and a new pixel value are computed by the graphics controller. The graphics controller compares the old Z value to the new Z value for the current pixel location to determine if the current pixel is closer to the observer than the pixel already stored in the frame buffer. The new pixel value is then written into the frame buffer for the current pixel location if the new pixel for that location is closer to the observer than the pixel stored in the frame buffer. If the new pixel is hidden, the controller proceeds to the next pixel location, leaving the old pixel value in the frame buffer and the old Z value in the Z-buffer. When the new pixel at a given location is closer to the observer than the old pixel, the controller writes the new Z value for the current pixel location into the Z-buffer. This process is then repeated for the next pixel along the scan line. When clearing in accordance with the prior art, a region of the Z-buffer is generally cleared in order to clear the corresponding region of the screen by writing the largest possible Z value into all locations selected for clearing.
As previously mentioned, the Z-buffer is usually cleared before the Z-buffer may be used to draw the new image. In order to clear a portion of the Z-buffer, the conventional approach typically includes initially determining the pixel locations in the region to be cleared. Then, the conventional graphics update controller will usually write the largest possible Z value into the Z-buffer for all pixel locations for each line to be cleared. However, a number of the prior art systems commonly suffer from a delay in clearing a region of the screen due to the need to clear the corresponding region in the Z-buffer. For example, to clear a Z-buffer which has 1280 by 1024 pixels and is 32 bits deep with a 64 bit memory word accessed at 25 MHz, the above mentioned conventional clearing approach typically requires a clearing time of more than 26 milliseconds just to clear the Z-buffer. This is a relatively large amount of time in a system which is supposed to draw images with "real time" motion capability. Such a clearing time would likely preclude full screen update rates of 30 Hz or faster.
An alternate approach to clearing the Z-buffer is disclosed in U.S. Pat. No. 5,038,297 to Hannah. The above-cited reference is incorporated herein by reference. The approach in Hannah employs a plurality of bits associated with the frame buffer for invalidating the Z values in the Z-buffer, instead of actually clearing the entire Z-values. Each of the invalidating bits consists of one bit of memory storage taken from a word in the frame buffer which is typically implemented with VRAM. Most of the time, the frame buffer is generally used for writing color and intensity for each pixel. By attaching the invalidating bits to the frame buffer, the Hannah approach forces additional reading of the frame buffer to invalidate the Z-buffer which would normally not otherwise be required.
A similar approach which uses invalidating bits is disclosed in U.S. Pat. No. 5,301,263 to Dowdell which is likewise incorporated herein by reference. The Dowdell approach has a Z-value and an invalid bit stored in memory for each Z-buffer address. The invalid bit in Dowdell indicates whether or not a corresponding Z-value memory location has a valid Z-value stored therein. The Dowdell approach further provides a way to quickly update Z-values during a rapid clearing of the graphics screen in which the invalid bits corresponding to the pixels to be cleared would be set to "one". While a quick update may be achieved with the use of invalid bits, the Dowdell reference fails to teach optimal organization of the invalid bits within memory and may require additional memory.
Accordingly, it is one object of the present invention to provide for an improved method and system for clearing or invalidating a region of the Z-buffer with increased speed.
It is a further object of the present invention to provide for an improved method for invalidating a region of Z-buffer in a manner which efficiently organizes a plurality of invalidating bits for invalidating the corresponding values in the Z-buffer and achieves enhanced performance with optimized memory use.
It is also an object of the present invention to achieve a less expensive and more efficient method and system for invalidating a portion of Z-buffer to clear the Z-buffer during updating operations performed with a raster scanned computer controlled video imaging system.
Yet another object of the present invention is to provide for such a method and system for invalidating a region of Z-buffer with organized invalidating bits that may selectively discontinue or continue use of the invalidating bits as desired.